﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using UofCASE.AgileProductLinerDSL.Util;
using System.ComponentModel;
using System.Reflection;

namespace UofCASE.AgileProductLinerDSL {
    partial class Test {

        private String GetNameValue() {
            if (this.IsMapped) {
                FileInfo file = new FileInfo(this.RelativePath);
                String testName = FileUtil.GetFileNameWithoutExtension(file);
                return testName;
            } else {
                return APLDRessources.NoTestMapped;
            }
        }

        private void SetNameValue(string newValue) {
            
        }

        public bool HasDefaultName() {
            foreach(PropertyDescriptor prop in TypeDescriptor.GetProperties(this)){
                if (prop.Name.Equals("Name")){
                    DefaultValueAttribute dva = prop.Attributes[typeof(DefaultValueAttribute)] as DefaultValueAttribute;
                    if (this.Name.Equals(dva.Value)) return true;
                    else return false;
                }
            }
            return false;
        }

    }
}
